import java.util.Arrays;

public class ArrayInvertor {
    public static void main(String[] args) {
        int[] array = new int[]{1, 19, 4, 6, 8, 23, 9, 12, 45};
        System.out.println(Arrays.toString(array));
        reverse(array);
        System.out.println(Arrays.toString(array));
    }

    static int[] reverse(int[] input) {
        for (int index = 0; index < input.length / 2; index++) {
            changeElement(input, index);
        }
        return input;
    }

    private static void changeElement(int[] input, int index) {
        int temporaryVariable;
        temporaryVariable = input[index];
        input[index] = input[input.length - index - 1];
        input[input.length - index - 1] = temporaryVariable;
    }
}
